package com.wencai.daily;

import org.jetbrains.annotations.NotNull;
import com.wencai.util.ExchangeDay;

/**
 * @author wangpan
 * @date 2023/6/6
 */
public class Test {

    public static String date = "20230103";


    // 竞价涨幅大于2%;竞价涨幅小于8%;主板;非st;竞价金额大于200万;

    public static void main(String[] args) {
        while (date.startsWith("2023")) {
//            String str = zhenfu();
//            String str = ruozhuanqiang();
//            String str = lanbanfanbao();
            String str = dixi();
            System.out.println(str);
        }
    }


    private static String dixi() {
        String str = "主板;非st;流通市值小于5000亿;";
        // str += fix("首板;");
        str += fix("最高价等于涨停价;");
        date = ExchangeDay.getNextExchangeDay(date);
        str += fix("最低价大于跌停价;");
        str += fix("最高价小于");
        date = ExchangeDay.getPreExchangeDay(date);
        str += fix("最高价;");
        date = ExchangeDay.getNextExchangeDay(date);
        str += fix("最低价大于");
        date = ExchangeDay.getPreExchangeDay(date);
        str += fix("最低价;");
        date = ExchangeDay.getNextExchangeDay(date);
        str += fix("振幅排倒序;");
        return str;
    }

    private static String yidong() {
        String str = "主板;非st;流通市值小于5000亿;";
        // str += fix("首板;");
        date = ExchangeDay.getNextExchangeDay(date);
        str += fix("9点30分至10点成交额大于3亿;");
        str += fix("9点30分至9点35分振幅大于3%;");
        str += fix("9点30分至9点35分成交额排序;");
        return str;
    }

    private static String jingjia2() {


        String str = "主板;非退市;非st;";
        date = ExchangeDay.getNextExchangeDay(date);
        str += fix("集合竞价涨幅大于0%;");
        str += fix("流通市值小于2000亿;");
        str += fix("集合竞价金额排序前10;");
        return str;
    }




    private static String renqi() {
        String str = "主板;非退市;非st;";

        str += "流通市值小于500亿;";
        date = ExchangeDay.getNextExchangeDay(date);
        str += fix("竞价金额/");
        date = ExchangeDay.getPreExchangeDay(date);
        str += fix("竞价金额<0.5;");

        String day = ExchangeDay.getLastOneMonthDay(date);
        str += fix("人气排序;");
        date = ExchangeDay.getNextExchangeDay(date);

        return str;
    }

    private static String jingjia() {
        String str = "主板;非退市;非st;";

        date = ExchangeDay.getNextExchangeDay(date);
        str += fix("竞价金额/");
        date = ExchangeDay.getPreExchangeDay(date);
        str += fix("竞价金额<0.5;");

        str += fix("均线发散;");
        String day = ExchangeDay.getLastOneMonthDay(date);
        str += day + "至" + fix("的涨停次数大于等于2;");
        date = ExchangeDay.getNextExchangeDay(date);

        str += fix("竞价金额排倒序;");
        return str;
    }


    private static String fanbao() {
        String str = "主板;非退市;非st;";
        str += fix("最高价等于涨停价;");
        date = ExchangeDay.getNextExchangeDay(date);
//        str += fix("9点30至10点最大涨幅大于3%;");
        return str;
    }


    private static String ruoban() {
        String str = "主板;非退市;非st;";
        str += fix("封单额小于1000万;");
        str += fix("封单额倒序;");
        date = ExchangeDay.getNextExchangeDay(date);
        return str;
    }

    @NotNull
    private static String zhaban() {
        String str = "主板;非退市;非st;";
        str += fix("最高价等于涨停价;");
        str += fix("收盘价小于涨停价;");
        date = ExchangeDay.getNextExchangeDay(date);
//        str += fix("最大涨幅大于6%;");
        return str;
    }

    @NotNull
    private static String zhangsu() {
        String str = "主板;非退市;非st;";
        str += fix("至");
        date = getNextExchangeDay(date, 4);
        str += fix("有涨停;或");
        date = getPreExchangeDay(date, 4);
        str += fix("至");
        date = getNextExchangeDay(date, 4);
        str += fix("有曾涨停;");
        date = ExchangeDay.getNextExchangeDay(date);
//        str += fix("9点30至9点35分涨速排名;");
        date = getPreExchangeDay(date, 4);
        return str;
    }

    private static String getNextExchangeDay(String date, int n) {
        String tempDate = date;
        for (int i = 0; i < n; i++) {
            tempDate = ExchangeDay.getNextExchangeDay(tempDate);
        }
        return tempDate;
    }

    private static String getPreExchangeDay(String date, int n) {
        String tempDate = date;
        for (int i = 0; i < n; i++) {
            tempDate = ExchangeDay.getPreExchangeDay(tempDate);
        }
        return tempDate;
    }


    @NotNull
    private static String lanbanfanbao() {
        String str = "主板;非退市;非st;";
        str += fix("最高价等于涨停价;");
        str += fix("收盘价小于涨停价;");
        date = ExchangeDay.getNextExchangeDay(date);
        str += fix("9点30至9点35分振幅大于3.5%;");
        str += fix("9点35分涨幅大于0;");
        str += fix("竞价涨跌幅小于2%;");
        str += fix("9点30至9点35分振幅排序;");
        return str;
    }

    @NotNull
    private static String ruozhuanqiang() {
        String str = "主板;非退市;非st;";
        str += fix("涨停;");
        str += fix("封单额小于1000万;");
        date = ExchangeDay.getNextExchangeDay(date);
        return str;
    }

    @NotNull
    private static String zhenfu() {
        String str = "主板;非退市;非st;";
        str += fix("9点30分至");
        str += fix("9点35分振幅大于7%;");
        str += fix("9点35分价格大于");
        str += fix("9点30分价格;");
        date = ExchangeDay.getNextExchangeDay(date);
        return str;
    }

    public static String fix(String x) {
        return date.substring(0, 4) + "年" + date.substring(4, 6) + "月" + date.substring(6, 8) + "日" + x;
    }
}
